<template>
  <d2-container class="tasklist">
    <template slot="header">任务列表</template>
    <el-row :gutter="22">
      <el-col :span="3">
        <el-select size="small" clearable v-model="activval" placeholder="提现状态">
          <el-option
            v-for="item in activlist"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-col>
      <el-col :span="3">
        <el-select size="small" clearable v-model="taskval" placeholder="任务状态">
          <el-option
            v-for="item in taskstatuslist"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-col>
      <el-col :span="5">
        <div style="display:flex;">
          <el-input v-model="appealval" style="width:150px;margin-right:20px;" type="text" size="small"
                    placeholder="请输入需要指派的旺旺"></el-input>
          <el-select size="small" clearable v-model="auditval" placeholder="请选择">
            <el-option
              v-for="item in auditlist"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </div>
      </el-col>
      <el-col :span="2">
        <el-input size="small" style="width:150px;" v-model.trim="iptval"
                  placeholder="请输入内容"></el-input>
      </el-col>
      <el-col :span="8">
        <div style="display:flex;margin-left:20px;">
          <el-select size="small" style="margin-right:20px;" clearable v-model="pjStatus" placeholder="请选择">
            <el-option
              v-for="item in auditPJ"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <el-date-picker
            style="width:100%;"
            size="small"
            v-model="timeval"
            type="daterange"
            align="right"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyy-MM-dd HH:mm:ss">
          </el-date-picker>
        </div>
      </el-col>
      <el-col :span="3">
        <el-button size="mini" type="primary" @click="onSearch">查询</el-button>
        <el-button type="primary" size="mini" @click="exportToExcel_two()">导出明细</el-button>
        <!--        <el-button size="mini" type="primary" @click="$router.go(0)">刷新</el-button>-->
      </el-col>
    </el-row>
    <el-table :data="tableData" @expand-change="rowClick"
              :expand-row-keys="expands"
              border
              :row-key='getRowKeys'
              style="width: 100%;margin-top:20px;">
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-form label-position="left" inline class="demo-table-expand">
            <el-form-item label="假聊:">
              <span>{{ props.row.actor }}</span>
            </el-form-item>
            <el-form-item label="浏览:">
              <span>{{ props.row.browse }}</span>
            </el-form-item>
            <el-form-item label="货比:">
              <span>{{ props.row.compare }}</span>
            </el-form-item>
            <el-form-item label="年龄:">
              <span>{{ props.row.generation }}</span>
            </el-form-item>
            <el-form-item label="任务类型:">
              <span v-if="props.row.coupon == 5" style="color:red;font-weight:600;">隔夜单</span>
              <span v-if="props.row.coupon == 4" style="color:#409eff;font-weight:600;">评价单</span>
              <span v-if="props.row.coupon == 3" style="color:#67c23a;font-weight:600;">浏览单</span>
              <span v-if="props.row.coupon == 2" style="color:#e6a23c;font-weight:600;">普通单</span>
              <span v-if="props.row.coupon == 1" style="color:#909399;font-weight:600;">优惠卷单</span>
            </el-form-item>
            <el-form-item label="性别:">
              <span>{{ props.row.repeat }}</span>
            </el-form-item>
            <el-form-item label="开始时间:">
              <span>{{ props.row.begin_time * 1000 | moment }}</span>
            </el-form-item>
            <el-form-item label="时间点单数:">
              <span>{{ props.row.time_count }}</span>
            </el-form-item>
            <el-form-item label="收藏:">
              <span>{{ props.row.favorites }}</span>
            </el-form-item>
            <el-form-item label="加入购物车:">
              <span>{{ props.row.shop_cart }}</span>
            </el-form-item>
            <el-form-item label="下单时间:" v-if="props.row.coupon == '5'">
              <span>{{ props.row.pay_time * 1000 | moment }}</span>
            </el-form-item>
            <el-form-item label="任务状态:">
              <el-select size="small" style="width:400px;" @change="UpdateUserStatuss($event,props.row)" clearable
                         v-model="props.row.task_user_status" placeholder="请选择">
                <el-option
                  v-for="item in auditstatus"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="间隔时间:">
              <span>{{ props.row.intervals }}</span>
            </el-form-item>
            <el-form-item label="下单方式:" v-if="props.row.coupon == '5'">
              <span>{{ props.row.orderway }}</span>
            </el-form-item>
            <el-form-item label="淘口令状态:">
              <span>{{ props.row.tkl_status }}</span>
            </el-form-item>
            <el-form-item label="宝贝ID:">
              <a :href="'https://detail.tmall.com/item.htm?id='+props.row.babyid"
                 target="_blank">{{ props.row.babyid }}</a>
            </el-form-item>
            <el-form-item label="标旗:">
              <span v-if="props.row.seller_flag == 0">无标旗</span>
              <span v-if="props.row.seller_flag == 1" style="color:red;font-size:18px;font-weight:600;">红</span>
              <span v-if="props.row.seller_flag == 2" style="color:yellow;font-size:18px;font-weight:600;">黄</span>
              <span v-if="props.row.seller_flag == 3" style="color:green;font-size:18px;font-weight:600;">绿</span>
              <span v-if="props.row.seller_flag == 4" style="color:blue;font-size:18px;font-weight:600;">蓝</span>
              <span v-if="props.row.seller_flag == 5" style="color:purple;font-size:18px;font-weight:600;">紫</span>
            </el-form-item>
            <el-form-item label="标旗备注:">
              <span>{{ props.row.seller_memo }}</span>
            </el-form-item>
            <el-form-item label="是否指派过" v-if="props.row.admin_log_zp_status !=0">
              <span>指派过次数为：{{ props.row.admin_log_zp_status }}</span>
              <el-button type="primary" size="mini"
                         @click="dialogTableVisible = true;gridData = props.row.admin_log_zp_info"
                         style="margin-left:10px;">查看详情
              </el-button>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>
      <el-table-column prop="create_time" fixed label="创建时间" width="160">
        <template slot-scope="scope">
          {{ scope.row.create_time }}
        </template>
      </el-table-column>
      <el-table-column label="序号" prop="id" width="60"></el-table-column>
      <el-table-column label="用户ID" prop="u_id" width="100"></el-table-column>
      <el-table-column prop="task_shopname" label="店铺名" width="160"></el-table-column>
      <el-table-column label="商品图片" width="100">
        <template slot-scope="scope">
          <img :src="scope.row.goods_img" alt="" style="width:50px;height:50px;margin:auto;">
        </template>
      </el-table-column>
      <el-table-column prop="key_word" label="商品关键词" width="200">
        <template slot-scope="scope">
          <span v-if="scope.row.key_word == ''" style="font-size:16px;color:purple;font-weight:600;">无关键词</span>
          <span v-if="scope.row.key_word != ''">{{ scope.row.key_word }}</span>
        </template>
      </el-table-column>
      <el-table-column label="任务类型" width="100">
        <template slot-scope="scope">
          <span v-if="scope.row.coupon == 6" style="color:purple;font-weight:600;font-size:18px">抖音单</span>
          <span v-if="scope.row.coupon == 5" style="color:red;font-weight:600;font-size:18px">隔夜单</span>
          <span v-if="scope.row.coupon == 4" style="color:#409eff;font-weight:600;font-size:18px">评价单</span>
          <span v-if="scope.row.coupon == 3" style="color:#67c23a;font-weight:600;font-size:18px">浏览单</span>
          <span v-if="scope.row.coupon == 2" style="color:#e6a23c;font-weight:600;font-size:18px">普通单</span>
          <span v-if="scope.row.coupon == 1" style="color:#909399;font-weight:600;font-size:18px">优惠卷单</span>
        </template>
      </el-table-column>
      <el-table-column prop="task_bjmoney" label="任务本金" width="100"></el-table-column>
      <el-table-column prop="task_yjmoney" label="任务佣金" width="100"></el-table-column>
      <el-table-column prop="taobao_name" label="刷手旺旺" width="100"></el-table-column>
      <el-table-column prop="task_order" label="订单号" width="100">
        <template slot-scope="scope">
          <span v-if="scope.row.task_order!=''">{{ scope.row.task_order }}</span>
          <span v-if="scope.row.task_order==''">暂无单号</span>
        </template>
      </el-table-column>
      <el-table-column label="提现状态" width="100">
        <template slot-scope="scope">
          <span>{{
              scope.row.tx_status == 0 ? '不可提现' : scope.row.tx_status == 1 ? '本金可提现' : scope.row.tx_status == 2 ? '佣金可提现' : '已全部提现'
            }}</span>
        </template>
      </el-table-column>
      <el-table-column label="任务状态" width="100">
        <template slot-scope="scope">
          <span>{{ ['', '领取到任务', '任务删除', '任务已经付款', '商家拒绝', '', '', '待审核'][scope.row.task_status] }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作"
                       fixed="right" align="center">
        <template slot-scope="scope">
          <el-dropdown trigger="click">
            <span class="el-dropdown-link" style="cursor: pointer;">
              操作按钮<i class="el-icon-caret-bottom"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item class="clearfix">
                <el-button type="primary" size="mini" @click="dialogVisible = true;rows = scope.row">指派</el-button>
              </el-dropdown-item>
              <el-dropdown-item class="clearfix">
                <el-button type="success" size="mini" @click="dialog = scope.row;Form = scope.row">修改</el-button>
              </el-dropdown-item>
              <el-dropdown-item class="clearfix">
                <el-button type="warning" size="mini" @click="pushmessage(scope.row)">推送</el-button>
              </el-dropdown-item>
              <el-dropdown-item class="clearfix">
                <el-button type="info" size="mini" @click="dialogremark = true;idremark = scope.row.task_id">备注
                </el-button>
              </el-dropdown-item>
<!--              <el-dropdown-item class="clearfix">-->
<!--                <el-button style="background:purple;color:white;" size="mini" @click="list_haopingS(scope.row.id)">评价处理-->
<!--                </el-button>-->
<!--              </el-dropdown-item>-->
              <el-dropdown-item class="clearfix">
                <el-button style="background:pink;color:white;" size="mini" @click="markings(scope.row)">打标
                </el-button>
              </el-dropdown-item>
              <el-dropdown-item class="clearfix">
                <el-button type="danger" size="mini" @click="del_taskS(scope.row)">删除
                </el-button>
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <el-button style="background:purple;color:white;" size="mini" @click="list_haopingS(scope.row.id)">评价处理
          </el-button>
          <el-button type="danger" size="mini" @click="cancle(scope.row.id)">取消</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination @current-change="handleCurrentChange" @size-change="handleSizeChange" :current-page.sync="page"
                   :page-sizes="[10,20, 30, 40, 50,100,300,500,1000]"
                   :page-size="pageSize" background layout="total, sizes, prev, pager, next, jumper" :total="total"
                   style="text-align:right;margin:10px 0;">
    </el-pagination>
    <!--转移目标-->
    <el-dialog
      title="转移目标"
      :visible.sync="dialogVisible"
      width="30%">
      <el-input type="text" v-model="tb_name" placeholder="请输入您要转移的旺旺"></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="operation()">确 定</el-button>
      </span>
    </el-dialog>
    <!--修改-->
    <el-dialog
      :visible.sync="dialog"
      width="30%">
      <el-form :model="Form" status-icon ref="ruleForm" label-width="100px" class="demo-ruleForm">
        <el-form-item label="金额">
          <el-input type="text" v-model="Form.task_bjmoney" placeholder="请输入金额"></el-input>
        </el-form-item>
        <el-form-item label="订单号">
          <el-input type="text" v-model="Form.task_order" placeholder="请输入订单号"></el-input>
        </el-form-item>
        <el-form-item label="店铺名字">
          <el-input type="text" v-model="Form.task_shopname" placeholder="请输入店铺名字"></el-input>
        </el-form-item>
        <el-form-item label="提现状态">
          <el-select v-model="Form.tx_status" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="时间">
          <el-date-picker
            v-model="Form.create_time"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="选择日期时间">
          </el-date-picker>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialog = false">取 消</el-button>
        <el-button type="primary" @click="update_tasklists()">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="指派详情" :visible.sync="dialogTableVisible">
      <el-table :data="gridData" border>
        <el-table-column property="admin" align="center" label="操作人"></el-table-column>
        <el-table-column property="note" align="center" label="操作详情"></el-table-column>
        <el-table-column property="create_time" align="center" label="操作时间"></el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog
      title="推送内容"
      :visible.sync="dialogs"
      width="30%">
      <div style="display:flex;align-items: center;align-items: center;width:100%;">
        <p>推送内容：</p>
        <el-select v-model="text" clearable filterable style="width:80%;"
                   allow-create
                   default-first-option placeholder="请选择您需要推送的内容">
          <el-option
            v-for="item in optionings"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </div>
      <div style="display:flex;" v-show="text == '您有一单需要去收货'">
        <p>推送催货：</p>
        <div style="display:flex;flex-direction: column;">
          <el-input type="text" v-model="task_shopname"></el-input>
          <el-input type="text" v-model="taobao_name"></el-input>
        </div>
      </div>
      <div style="display:flex;" v-show="text == '您有一单评价内容已给，请在平台里面查看评价内容,记得上传评价截图,方便返款'">
        <p>推送评价：</p>
        <div style="display:flex;flex-direction: column;">
          <el-input type="text" v-model="task_shopname"></el-input>
          <el-input type="text" v-model="taobao_name"></el-input>
          <el-input type="text" v-model="task_order"></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogs = false">取 消</el-button>
        <el-button type="primary" @click="push()">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="标旗备注"
      :visible.sync="dialogremark"
      width="30%">
      <div style="display:flex;align-items: center;">
        <span>选择标旗：</span>
        <el-select v-model="seller_flag" placeholder="请选择标旗">
          <el-option
            v-for="item in optioning"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </div>
      <br/>
      <div style="display:flex;align-items: center;">
        <span>标旗备注：</span>
        <el-input type="text" style="width:40%" v-model="remarks" placeholder="请输入备注"></el-input>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogremark = false">取 消</el-button>
        <el-button type="primary" @click="remark()">确 定</el-button>
      </span>
    </el-dialog>
  </d2-container>
</template>

<script>
import {
  tasklist,
  assigntask,
  create_task_flag,
  taskreminder,
  canceltask,
  update_tasklist,
  tasktkl,
  DbTb,
  list_haoping,
  del_task,
  brushstatus,
  UpdateUserStatus,
} from '@api/sys.login';
export default {
  data() {
    return {
      tableData: [],
      dialogs: false,
      gridData: [],
      page: 1,
      total: 0,
      rows: [],
      task_shopname:"",
      taobao_name:"",
      task_order:"",
      pjStatus: "",
      textpush:"",
      options:[
        {label: "没完成订单不可以 提现", value: 0},
        {label: "本金可提取", value: 1},
        {label: "佣金可提取", value: 2},
        {label: "该订单已经提完", value: 3},
      ],
      auditstatus: [
        {label: "正常,（申请都没申请）", value: 1},
        {label: "申请中（没接到任务) ", value: 2},
        {label: "接到任务 （刚刚接到任务）", value: 3},
        {label: "已确认领取（买手确认领取）", value: 4},
      ],
      optioning: [
        {label: "红", value: "1"},
        {label: "黄", value: "2"},
        {label: "绿", value: "3"},
        {label: "蓝", value: "4"},
        {label: "紫", value: "5"},
      ],
      auditPJ: [
        {label: "待评价", value: 1},
        {label: "评价完成", value: 2},
        {label: "评价提交等待审核", value: 3},
        {label: "商家已上传评价", value: 4},
      ],
      TbName: "",
      remarks: '',
      phone: "",
      dialogTableVisible: false,
      Form: {
        task_bjmoney: "",
        create_time: "",
        task_order: "",
        task_shopname: "",
        taobao_name: ""
      },
      idremark: [],
      dialogremark: false,
      expands: [],
      activval: '',
      dialogVisible: false,
      dialog: false,
      activlist: [
        {
          value: 0,
          label: '不可提现',
        },
        {
          value: 1,
          label: '本金可提现',
        },
        {
          value: 2,
          label: '佣金可提现',
        },
        {
          value: 3,
          label: '已全部提现',
        }
      ],
      tb_name: "",
      taskval: 1,
      taskstatuslist: [
        {
          value: '',
          label: '全部',
        },
        {
          value: 1,
          label: '已领取任务',
        },
        {
          value: 2,
          label: '任务已删除',
        },
        {
          value: 3,
          label: '任务已付款',
        },
        {
          value: 7,
          label: '任务待审核',
        },
      ],
      appealval: '',
      appeallist: [
        {
          value: '指派',
          label: '指派',
        },
      ],
      auditval: '',
      auditlist: [
        {
          value: '用户名',
          label: '用户名',
        },
        {
          value: '店铺名',
          label: '店铺名',
        },
        {
          value: '手机号',
          label: '手机号',
        },
        {
          value: '旺旺号',
          label: '旺旺号',
        },
        {
          value: '订单号',
          label: '订单号',
        }
      ],
      getRowKeys(row) {
        return row.id
      },
      seller_flag: "",
      iptval: '',
      pageSize: 10,
      text:"",
      optionings: [
        {value:"您有一单评价内容已给，请在平台里面查看评价内容,记得上传评价截图,方便返款",label:"您有一单评价内容已给，请在平台里面查看评价内容,记得上传评价截图,方便返款"},
        {value:"您有一单需要去收货",label:"您有一单需要去收货"},
        {value:"您有新的订单来袭，请前往“这一根葱”公众号",label:"您有新的订单来袭，请前往“这一根葱”公众号"},
        {value:"您的单子有任何问题直接联系QQ客服群1051094300",label:"您的单子有任何问题直接联系QQ客服群1051094300"},
        {value:"隔夜单可以付款了。请及时前往“这一根葱”公众号下单付款以及提交",label:"隔夜单可以付款了。请及时前往“这一根葱”公众号下单付款以及提交"},
      ],
      lists: {},
      timeval: [],
    }
  },
  mounted() {
    let params = {
      page: this.page,
      pageSize: this.pageSize,
      begin_time: this.timeval[0],
      end_time: this.timeval[1],
      tx_status: this.activval,
      status: this.taskval,
      complaint_status: this.appealval,
    }
    this.getUserList(params)
  },
  methods: {
    pushchoose(val){
      console.log(val);
    },
    pushmessage(row){
      this.dialogs = true;
      this.ids = row;
      this.task_shopname = '店铺名:'+this.ids.task_shopname
      this.taobao_name = '旺旺号:'+this.ids.taobao_name
      this.task_order = '订单号:'+this.ids.task_order
    },
    exportToExcel_two() {
      require.ensure([], () => {
        const {
          export_json_to_excel
        } = require('../../../excel/Export2Excel');
        const tHeader = ['序号', '店铺名', '商品关键词', '任务类型','任务本金', '任务佣金', '买手旺旺', '订单号','创建时间'];
        const filterVal = ['id', 'task_shopname','key_word','coupon','task_bjmoney','task_yjmoney', 'taobao_name', 'task_order','create_time'];
        let arring = this.tableData
        const list = arring;
        const data = this.formatJson(filterVal, list);
        export_json_to_excel(tHeader, data, '订单明细excel');
      })
    },
    formatJson(filterVal, jsonData) {
      return jsonData.map(v => filterVal.map(j => v[j]))
    },
    UpdateUserStatuss(val,row) {
      let params = {
        user_id: row.u_id,
        user_status: val,
      }
      UpdateUserStatus(params).then((res) => {

      })
    },
    del_taskS(row) {
      del_task(row.id, row.u_id).then((res) => {
        this.getUserList()
      })
    },
    list_haopingS(id) {
      let params = {
        id: id
      }
      list_haoping(params).then(res => {
        console.log(res);
      })
    },
    markings(row) {
      let params = {
        itemid: row.babyid,
        keyword: row.key_word,
        nick: row.taobao_name
      }
      DbTb(params).then((res) => {

      })
    },
    remark() {
      let params = {
        task_id: this.idremark,
        seller_flag: this.seller_flag,
        seller_memo: this.remarks,
      }
      create_task_flag(params).then((res) => {
        console.log(res);
        this.dialogremark = false
      })
    },
    //推送
    push() {
     if(this.text != '您有一单需要去收货' && this.text != '您有一单评价内容已给，请在平台里面查看评价内容,记得上传评价截图,方便返款'){
       this.task_shopname = ''
       this.taobao_name = ''
       this.task_order = ''
     }
      let params = {
        id: this.ids.u_id,
        text: this.text+this.task_shopname+','+this.taobao_name+','+this.task_order
      }
      taskreminder(params).then((res) => {
        this.dialogs = false
      })
    },
    handleSizeChange(val) {
      this.pageSize = val
      this.onSearch()
    },
    rowClick(row, expandedRows) {
      console.log(row);
      if (expandedRows.length) {
        this.expands = []
        if (row) {
          this.expands.push(row.id)
        }
      } else {
        this.expands = []
      }
      tasktkl(row.id, row.task_id, row.u_id).then((res) => {
        this.$nextTick(() => {
          console.log(res);
          this.lists = res.list
          this.tableData.forEach((item) => {
            if (row.task_id == item.task_id) {
              item.actor = this.lists.actor
              item.begin_time = this.lists.begin_time
              item.task_user_status = this.lists.task_user_status
              item.browse = this.lists.browse
              item.compare = this.lists.compare
              item.createtime = this.lists.createtime5
              item.favorites = this.lists.favorites
              item.generation = this.lists.generation
              item.group = this.lists.group
              item.intervals = this.lists.intervals
              item.orderway = this.lists.orderway
              item.pay_time = this.lists.pay_time
              item.repeat = this.lists.repeat
              item.shop_cart = this.lists.shop_cart
              item.time_count = this.lists.time_count
              item.tkl_status = this.lists.tkl_status
              item.admin_log_zp_status = this.lists.admin_log_zp_status
              item.admin_log_zp_info = this.lists.admin_log_zp_info
              item.seller_flag = this.lists.seller_flag
              item.seller_memo = this.lists.seller_memo
            }
          })
          console.log(this.tableData);
        })
      })
    },
    //修改
    update_tasklists() {
      update_tasklist(this.Form.task_bjmoney, this.Form.create_time, this.Form.id, this.Form.task_order, this.Form.task_shopname,this.Form.tx_status).then((res) => {
        console.log(res);
        this.dialog = false
        let params = {
          page: this.page,
          pageSize: this.pageSize,
          begin_time: this.timeval[0],
          end_time: this.timeval[1],
          tx_status: this.activval,
          status: this.taskval,
          complaint_status: this.appealval,
        }
        this.getUserList(params)
      })
    },
    //取消
    cancle(id) {
      canceltask(id).then((res) => {
        console.log(res);
      })
    },
    //操作
    operation() {
      assigntask(this.rows.id, this.tb_name).then((res) => {
        this.dialogVisible = false
      })
    },
    // 获取列表数据
    getUserList(params) {
      tasklist(params)
        .then((res) => {
          console.log('任务列表', res)
          this.total = res.count
          this.tableData = res.list.map((item) => {
            this.$set(item, 'actor', '')
            this.$set(item, 'begin_time', '')
            this.$set(item, 'task_user_status', '')
            this.$set(item, 'browse', '')
            this.$set(item, 'compare', '')
            this.$set(item, 'createtime', '')
            this.$set(item, 'favorites', '')
            this.$set(item, 'generation', '')
            this.$set(item, 'group', '')
            this.$set(item, 'intervals', '')
            this.$set(item, 'orderway', '')
            this.$set(item, 'pay_time', '')
            this.$set(item, 'repeat', '')
            this.$set(item, 'shop_cart', '')
            this.$set(item, 'time_count', '')
            this.$set(item, 'tkl_status', '')
            this.$set(item, 'seller_flag', '')
            this.$set(item, 'seller_memo', '')
            return item
          })
          console.log(this.tableData);
        })
    },
    handleCurrentChange(val) {
      this.page = val
      this.onSearch()
    },
    //查询
    onSearch() {
      if (this.timeval.length > 0) {
        let list = [...this.timeval]
        let index = list[1].indexOf(" ");
        list[1] = list[1].substring(0, list[1].length - index + 1) + ' 23:59:59'
        this.timeval[1] = list[1]
      }
      this.expands = []
      let params = {
        page: this.page,
        pageSize: this.pageSize,
        begin_time: this.timeval[0],
        end_time: this.timeval[1],
        tx_status: this.activval,
        status: this.taskval,
        filter: this.appealval,
        pjStatus: this.pjStatus,
      }
      if (this.auditval == '用户名') {
        params.user_name = this.iptval
      } else if (this.auditval == '旺旺号') {
        params.tb_name = this.iptval
      } else if (this.auditval == '店铺名') {
        params.shop_name = this.iptval
      } else if (this.auditval == '手机号') {
        params.phone = this.iptval
      } else {
        params.task_order = this.iptval
      }
      this.getUserList(params)
    },
  }
}
</script>

<style lang="scss" scoped>
.tasklist {
  .demo-table-expand {
    font-size: 0;
  }

  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }

  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 50%;
  }
}
</style>


